Gas Variation for TXs in Block Range {12.86M, 12.94M}

We queried the transactions' gas costs in 80,000 blocks (block height range {12.86M, 12.94M}). The reuslts include gas costs under both post-Berlin and post-Verkle gas schedule. In the charts the following are presented:

  1. number of transactions (%) that cost more/less/equal gas under the post-Verkle gas schedule compared to the post-Berlin gas schedule
  2. gas allocation (%) regarding storage accesses and other operations under the post-Berlin gas schedule
  3. gas allocation (%) regarding storage accesses, code accesses and other operations under the post-Verkle gas schedule

In the following histograms, for the same range of blocks and regarding the post-Verkle gas schedule, we present detailed information for the distribution of transactions over

  1. the percentage of gas cost decrease, for transactions that become cheaper
  2. the factor of gas cost increase, for transactions that become costlier

Gas Variation for Contracts called in Block Range {12.86M, 12.94M}

In the following histograms, for the same range of blocks and regarding the post-Verkle gas schedule, we present detailed information for the distribution of contracts over

  1. the percentage of gas cost decrease, for contracts that become cheaper
  2. the factor of gas cost increase, for contracts that become costlier

For this analysis we adopted a worst-case-scenario approach, considering each contract to be "represented" by the most expensive, gas-wise, transaction that called it.

Code Hashing Proposal

To reduce the code access penalty Dr.Neville Grech suggested an alternate code chunk accessing scheme. Since many smart contracts are deployed multiple times with the same code, addressing the code by the codehash rather than by the contract address would allow the bytecode to be re-used without charging extra.

Currently the code chunk access uses the following mechanism;

(address, (chunk_id + 128) // 256, (chunk_id + 128) % 256)

This mechanism would remain in place for the first 128 chunk_id used for code, where after the following access scheme is used;

(address, (chunk_id - 128) // 256, (chunk_id - 128) % 256)

To assess the impacts of these changes analyses were run on ~8000 blocks from block 12.93M to 12.94M.

Winners and Losers

The 8185 blocks studied contained a total of 974719 outer transactions, from these 42110 benefitted and 195 performed worse. The proposal therefore positively impacts 4.3% of transactions and negatively impacts 0.0002%.

Margins

With ~4% of transactions effected by the change it is worth establishing the margin of improvement for these effected transactions. From the computed histogram the majority of the transactions fall into the 5-10% improvement bracket with the overall average sitting at an ~8% margin of improvement.

The following histogram provides detailed information about the gas savings (%) of the analysed transactions.

Confirming Suspicions

To confirm the assumption that the code chunking benefits transactions that interact with multiple deployed versions of the same contract, we can filter for transactions which have fewer unique codehash interactions than address interactions. In the example below we filter for contracts which interact with 3 times more addresses than code hashes, which causes the average savings to jump from ~8% to ~36%.